<?php

namespace app\selladmin\model;

use think\Model;
use think\Db;

/*
 * 订单
 */

class Coupon extends Model {

    //代金券列表
    public function CouponList($store_id, $pagenum) {
        if ($store_id) {
            $couponwhere['store_id'] = $store_id;
        }
        $couponwhere['type'] = 1;
        $couponwhere = isset($couponwhere) ? $couponwhere : [];
        $couponList = Coupon::where($couponwhere)
                ->order("add_time desc")
                ->paginate($pagenum)
                ->appends($couponwhere);
        return $couponList;
    }

}
